import request from '@/utils/request'

// 获取月视图数据
export function getMonthViewData(params) {
  return request({
    url: '/dispatch/web/yuedupaiban/record/getMonthViewData',
    method: 'get',
    params
  })
}

// 获取周视图数据
export function getWeekViewData(params) {
  return request({
    url: '/dispatch/web/yuedupaiban/record/getWeekViewData',
    method: 'get',
    params
  })
}

// 获取人员列表
export function getPersonList(params) {
  return request({
    url: '/dispatch/web/yuedupaiban/record/getPersonList',
    method: 'get',
    params
  })
}

// 获取班次列表
export function getClassesList(params) {
  return request({
    url: '/dispatch/web/yuedupaiban/record/getClassesList',
    method: 'get',
    params
  })
}

// 获取周期模板列表
export function getCycleList(params) {
  return request({
    url: '/dispatch/web/cycle/zhouqi/list',
    method: 'get',
    params
  })
}

// 新增排班记录
export function addRosterRecord(data) {
  return request({
    url: '/dispatch/web/yuedupaiban/record',
    method: 'post',
    data
  })
}

// 更新排班记录
export function updateRosterRecord(data) {
  return request({
    url: '/dispatch/web/yuedupaiban/record',
    method: 'put',
    data
  })
}

// 删除排班记录
export function deleteRosterRecord(id) {
  return request({
    url: `/dispatch/web/yuedupaiban/record/${id}`,
    method: 'delete'
  })
}

// 获取排班记录详情
export function getRosterRecordDetail(id) {
  return request({
    url: `/dispatch/web/yuedupaiban/record/${id}`,
    method: 'get'
  })
}

// 一键排班
export function oneClickRoster(data) {
  return request({
    url: '/dispatch/web/yuedupaiban/record/yiJianPaiBan',
    method: 'post',
    data
  })
}

// 导出排班数据
export function exportRosterRecord(params) {
  return request({
    url: '/dispatch/web/yuedupaiban/record/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 获取周期班次列表（用于周期模板）
export function getCycleClassesList(params) {
  return request({
    url: '/dispatch/web/yuedupaiban/record/getCycleClassesList',
    method: 'get',
    params
  })
}

// 获取周期模板详情
export function getCycleDetail(id) {
  return request({
    url: `/dispatch/web/yuedupaiban/record/getCycleDetail/${id}`,
    method: 'get'
  })
}

// 新增周期模板
export function addCycle(data) {
  return request({
    url: '/dispatch/web/yuedupaiban/record/addCycle',
    method: 'post',
    data
  })
}

// 更新周期模板
export function updateCycle(data) {
  return request({
    url: '/dispatch/web/yuedupaiban/record/updateCycle',
    method: 'put',
    data
  })
}

// 删除周期模板
export function deleteCycle(id) {
  return request({
    url: `/dispatch/web/yuedupaiban/record/deleteCycle/${id}`,
    method: 'delete'
  })
}